﻿namespace BomberGame
{
    using System.Diagnostics.Contracts;
    using Microsoft.Xna.Framework.Input;

    public class ControlScheme
    {
        private static readonly ControlScheme[] _controlSchemes = new[]
            {
                new ControlScheme(), 
                new ControlScheme(Keys.I, Keys.K, Keys.J, Keys.L, Keys.Space)
            };

        private ControlScheme()
        {
            Up = Keys.W;
            Down = Keys.S;
            Left = Keys.A;
            Right = Keys.D;
            Bomb = Keys.LeftShift;
        }

        private ControlScheme(Keys up, Keys down, Keys left, Keys right, Keys bomb)
        {
            Up = up;
            Down = down;
            Left = left;
            Right = right;
            Bomb = bomb;
        }

        public Keys Up { get; private set; }

        public Keys Down { get; private set; }

        public Keys Left { get; private set; }

        public Keys Right { get; private set; }

        public Keys Bomb { get; private set; }

        public static ControlScheme GetControlScheme(int player)
        {
            Contract.Requires(player == 1 || player == 2);
            Contract.Ensures(Contract.Result<ControlScheme>() != null);
            return _controlSchemes[player - 1];
        }
    }
}
